package com.neusoft.resturant.service.impl;


import com.neusoft.resturant.common.utils.DateUtils;
import com.neusoft.resturant.entity.ResAddress;
import com.neusoft.resturant.mapper.ResAddressMapper;
import com.neusoft.resturant.service.IResAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 地址Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-10
 */
@Service
public class ResAddressServiceImpl implements IResAddressService
{
    @Autowired
    private ResAddressMapper resAddressMapper;

    /**
     * 查询地址
     * 
     * @param id 地址主键
     * @return 地址
     */
    @Override
    public ResAddress selectResAddressById(Long id)
    {
        return resAddressMapper.selectResAddressById(id);
    }

    /**
     * 查询地址列表
     * 
     * @param resAddress 地址
     * @return 地址
     */
    @Override
    public List<ResAddress> selectResAddressList(ResAddress resAddress)
    {
        return resAddressMapper.selectResAddressList(resAddress);
    }

    /**
     * 新增地址
     * 
     * @param resAddress 地址
     * @return 结果
     */
    @Override
    public int insertResAddress(ResAddress resAddress)
    {
        resAddress.setCreateTime(DateUtils.getNowDate());
        return resAddressMapper.insertResAddress(resAddress);
    }

    /**
     * 修改地址
     * 
     * @param resAddress 地址
     * @return 结果
     */
    @Override
    public int updateResAddress(ResAddress resAddress)
    {
        resAddress.setUpdateTime(DateUtils.getNowDate());
        return resAddressMapper.updateResAddress(resAddress);
    }

    /**
     * 批量删除地址
     * 
     * @param ids 需要删除的地址主键
     * @return 结果
     */
    @Override
    public int deleteResAddressByIds(Long[] ids)
    {
        return resAddressMapper.deleteResAddressByIds(ids);
    }

    /**
     * 删除地址信息
     * 
     * @param id 地址主键
     * @return 结果
     */
    @Override
    public int deleteResAddressById(Long id)
    {
        return resAddressMapper.deleteResAddressById(id);
    }
}
